<?php

class WhoIsOnline extends AbstractBox {
	protected $template = 'user/who_is_online.tpl';
	
	protected function setup() {
		$loggedUser = LoggedUser::whoIsLogged();
		if (!$loggedUser) {
			Utils::redirect('uvod.html');
		} else {
			$userRepository = new UserRepository();
			$userRepository->setAdditionalWhere(array(array('column' => 'is_online', 'value' => strtotime('-30 minutes'), 'xxx' => '>=')));
			$userRepository->addOrderBy(array('is_online' => 'desc'));
			$onlineUsers = $userRepository->getAll();
			MySmarty::assign('onlineUsers', $onlineUsers);
		}
	}
}

?>